package com.thrd.taiexhibition.activity;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.thrd.taiexhibition.R;
import com.thrd.taiexhibition.adapter.EnterpriseInfoAdapter;
import com.thrd.taiexhibition.base.BackTitleActivity;
import com.thrd.taiexhibition.bean.DayEnterprationInfo;
import com.thrd.taiexhibition.presener.EnterpriseInfoPresener;
import com.thrd.taiexhibition.view.EnterpriseInfoView;

import java.util.List;

/**
 * @author: ${唐杰}
 * @date: 2021/4/1
 */
@Route(path = "/app/enterpriseinfo",group = "app")
public class EnterpriseInfoActivity extends BackTitleActivity implements EnterpriseInfoView {


    private EnterpriseInfoPresener mEnterpriseInfoPresener;
    private RecyclerView mRecyclerView;
    private EnterpriseInfoAdapter mEnterpriseInfoAdapter;

    @Override
    protected int getLayout() {
        return R.layout.activity_enterprise_info;
    }

    @Override
    protected void initView() {
        mRecyclerView = (RecyclerView) findViewById(R.id.rv_recyclerview);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
//        SnapHelper mSnapHelper=new PagerSnapHelper();
//        mSnapHelper.attachToRecyclerView(mRecyclerView);
    }

    @Override
    protected void initData() {
        mEnterpriseInfoAdapter = new EnterpriseInfoAdapter(this,null);
        mRecyclerView.setAdapter(mEnterpriseInfoAdapter);

        mEnterpriseInfoPresener = new EnterpriseInfoPresener(this);
        mEnterpriseInfoPresener.getEnterpriseInfo(1);
    }

    @Override
    protected void initEvent() {

    }

    @Override
    public void onError(String error, int type) {

    }

    @Override
    public void onSuccess(List<DayEnterprationInfo> mDayEnterprationInfoList) {
        mEnterpriseInfoAdapter.setData(mDayEnterprationInfoList);
    }
}
